package com.example.knowman.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.knowman.ReturnMessage.Message;
import com.example.knowman.entity.archDept;
import com.example.knowman.entity.knowCategory;
import com.example.knowman.entity.knowMain;
import com.example.knowman.mapper.ArchDeptMapper;
import com.example.knowman.mapper.KnowCategoryMapper;
import com.example.knowman.mapper.StaffListMapper;
import com.example.knowman.service.IArchDeptService;
import com.example.knowman.service.IKnowCategoryService;
import com.example.knowman.service.IStaffListService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Service
public class ArchDeptServiceImpl extends ServiceImpl<ArchDeptMapper, archDept> implements IArchDeptService {

    private final ArchDeptMapper archDeptMapper;


    public ArchDeptServiceImpl(ArchDeptMapper archDeptMapper) {
//        this.iTable1Service = iTable1Service;
        this.archDeptMapper = archDeptMapper;

    }


    @Override
    public List<archDept> showAll() {
        List<archDept> list = this.lambdaQuery().select().list();
        return list;
    }

    @Override
    public archDept isManager(String manager) {
        return this.lambdaQuery().select().eq(archDept::getManager,manager).one();
    }

    @Override
    public Map<String, archDept> getMapAll() {
        return this.lambdaQuery().select().list().stream()
                .collect(Collectors.toMap(archDept::getArchDeptCode, Function.identity()));
    }
}
